import { useEffect } from "react";
import { useNavigate } from "react-router-dom";

export const useAuth = () => {
  const nav = useNavigate();
  useEffect(() => {
    const token = localStorage.getItem("token");
    if (!token) nav("/login");
  }, []);
};
